<?
/* 
 * Amnesia is Copyright (c) 2010 Mark Russell
 * 
 * Contact: info@amnesia-app.com	
 * 
 * This file is part of Amnesia.
 * 
 * Amnesia is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Amnesia is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Amnesia. If not, see <http://www.gnu.org/licenses/>.
 *
 */

session_start(); 
include("../db/db.php");
include("login.php");

/**
 * Delete cookies - the time must be in the past,
 * so just negate what you added when creating the
 * cookie.
 */
if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookpass'])){
   setcookie("cookname", "", time()-60*60*24*100, "/");
   setcookie("cookpass", "", time()-60*60*24*100, "/");
}

if(!$logged_in){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Amnesia. Feel free to forget.</title>
	<link rel="stylesheet" href="../css/amnesia.css" type="text/css" media="screen" />
	<script type="text/javascript" src="../lib/jquery.js"></script>
	<script type="text/javascript" src="../login/login.js"></script>
</head>
<body>
	<div id="main">
		<div id="container">
			<div id="left_retainer"></div>
			<div id="col1">
				<img src="../img/core/amnesia_logo.jpg" alt="Amnesia. Feel free to forget" width="187" height="184"/>
				<div id="login_status_locked">
					<strong>Amnesia is locked</strong><br/>You are signed-out
				</div>
			</div>
			
			<!-- Locked single column -->
			<div id="col_container_locked">
				<div id="status_locked">
					<div id="status_left"></div>
					<div id="status_right">
						<div id="amnesia_locked">Amnesia is locked and nobody is signed-in<img class="status_icn" src="../img/core/lock_icon.png" alt="lock_icon" width="9" height="12"/></div>
					</div>
				</div>
				<div id="login">
					<div id="login_contents_logout">
						<p id="key_message">Whoops!</p>
						<p>&nbsp;</p>
						<p class="text">You're not currently signed-in, so we can't sign you&nbsp;out.</p>
						<p><img src="../img/core/arrow_small_dark.png" alt="arrow_small_dark" width="4" height="7"/> <a class="login_text_link" href="../index.php" title="Sign-in to Amnesia">Please sign-in here.</p>
					</div>
				</div>
			</div>
			<div class="clear_top_pad"></div>
		</div>
	</div>
</body>
</html>
<?
}
else{
   /* Kill session variables */
   unset($_SESSION['username']);
   unset($_SESSION['password']);
   $_SESSION = array(); // reset session array
   session_destroy();   // destroy session.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Amnesia. Feel free to forget.</title>
	<link rel="stylesheet" href="../css/amnesia.css" type="text/css" media="screen" />
	<script type="text/javascript" src="../lib/jquery.js"></script>
	<script type="text/javascript" src="../login/login.js"></script>
</head>
<body>
	<div id="main">
		<div id="container">
			<div id="left_retainer"></div>
			<div id="col1">
				<img src="../img/core/amnesia_logo.jpg" alt="Amnesia. Feel free to forget" width="187" height="184"/>
				<div id="login_status_locked">
					<strong>Amnesia is locked</strong><br/>You are signed-out
				</div>
			</div>
			
			<!-- Locked single column -->
			<div id="col_container_locked">
				<div id="status_locked">
					<div id="status_left"></div>
					<div id="status_right">
						<div id="amnesia_locked">Amnesia is locked and nobody is signed-in<img class="status_icn" src="../img/core/lock_icon.png" alt="lock_icon" width="9" height="12"/></div>
					</div>
				</div>
				<div id="login">
					<div id="login_contents_logout">
						<p id="key_message">Goodbye.</p>
						<p>&nbsp;</p>
						<p class="text">You've successfully signed-out of Amnesia.</p>
						<p><img src="../img/core/arrow_small_dark.png" alt="arrow_small_dark" width="4" height="7"/> <a class="login_text_link" href="../index.php" title="Sign-in to Amnesia">Sign-in again.</p>
					</div>
				</div>
			</div>
			<div class="clear_top_pad"></div>
		</div>
	</div>
</body>
</html>
<?
}

?>